package com.zqx.factory.factory;

import com.zqx.factory.product.Chart;
import com.zqx.factory.product.HistogramChart;
import com.zqx.factory.product.LineChart;
import com.zqx.factory.product.PieChart;
import lombok.extern.slf4j.Slf4j;

/**
 * 工程类
 * @author zqx
 * @date 2018/09/01
 */
@Slf4j
public class ChartFactory {

    public static Chart getChart(String type)
    {
        Chart chart = null;

        if(type.equalsIgnoreCase("histogram"))
        {
            chart = new HistogramChart();
            log.info("初始化设置柱状图");
        }else if(type.equalsIgnoreCase("pie"))
        {
            chart = new PieChart();
            log.info("初始化设置饼图");
        }else if (type.equalsIgnoreCase("line"))
        {
            chart = new LineChart();
            log.info("初始化设置折线图");
        }
        return chart;
    }
}
